<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 两时间的时间差
        function fun(date, date1) {
            var number = date.getTime()
            var number1 = date1.getTime()
            return Math.abs(number - number1)
        }
        var date = new Date()
        var dateOld = new Date('2020', '7', '19', '19', '26', '22')
        var cha = fun(date, dateOld)
        var chasec = parseInt(cha / 1000)
        setInterval(function () {
            console.log(chasec)
            chasec--
            if (chasec <= 0) {
                return
            }
        }, 1000)
    </script>
</body>

</html>